home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Magazine / PC2Amiga / Samba / docs / textdocs / NT_Security.txt < prev    next >
Text File  |  2000-04-25  |  13KB  |  308 lines

  1. !==
  2. !== NT_Security.txt for Samba release 2.0.7 26 Apr 2000
  3. !==
  4.  
  5. TITLE INFORMATION: Viewing and changing UNIX permissions using the NT security dialogs in Samba 2.0.4 
  6. AUTHOR INFORMATION: Jeremy Allison, Samba Team 
  7. DATE INFORMATION: 12th April 1999 
  8.  
  9. Contents 
  10.  
  11. Viewing and changing UNIX permissions using the NT security dialogs 
  12.  
  13. ------------------------------------------------------------------- 
  14.  
  15. New in the Samba 2.0.4 release is the
  16. ability for Windows NT clients to use their native security
  17. settings dialog box to view and modify the underlying UNIX
  18. permissions.
  19.  
  20. Note that this ability is careful not to compromise the security
  21. of the UNIX host Samba is running on, and still obeys all the
  22. file permission rules that a Samba administrator can set.
  23.  
  24. In Samba 2.0.4 and above the default value of the parameter
  25. "nt acl support" has been
  26. changed from "false" to "true", so manipulation of permissions is
  27. turned on by default.
  28.  
  29. How to view file security on a Samba share
  30.  
  31. ------------------------------------------
  32.  
  33. From an NT 4.0 client, single-click with the right mouse button on
  34. any file or directory in a Samba mounted drive letter or UNC path.
  35. When the menu pops-up, click on the Properties entry at the 
  36. bottom of the menu. This brings up the normal file properties dialog
  37. box, but with Samba 2.0.4 this will have a new tab along the top
  38. marked Security. Click on this tab and you will see three buttons,
  39. Permissions, Auditing, and Ownership. The Auditing
  40. button will cause either an error message "A requested privilege is
  41. not held by the client" to appear if the user is not the NT Administrator,
  42. or a dialog which is intended to allow an Administrator to add
  43. auditing requirements to a file if the user is logged on as the
  44. NT Administrator. This dialog is non-functional with a Samba
  45. share at this time, as the only useful button, the Add button
  46. will not currently allow a list of users to be seen.
  47.  
  48. Viewing file ownership
  49.  
  50. ----------------------
  51.  
  52. Clicking on the "Ownership" button brings up a dialog box telling
  53. you who owns the given file. The owner name will be of the form :
  54.  
  55. "SERVER\user (Long name)"
  56.  
  57. Where SERVER is the NetBIOS name of the Samba server, user
  58. is the user name of the UNIX user who owns the file, and (Long name)
  59. is the discriptive string identifying the user (normally found in the
  60. GECOS field of the UNIX password database). Click on the Close
  61. button to remove this dialog.
  62.  
  63. If the parameter "nt acl support"
  64. is set to "false" then the file owner will be shown as the NT user
  65. "Everyone".
  66.  
  67. The Take Ownership button will not allow you to change the
  68. ownership of this file to yourself (clicking on it will display a
  69. dialog box complaining that the user you are currently logged onto
  70. the NT client cannot be found). The reason for this is that changing
  71. the ownership of a file is a privilaged operation in UNIX, available
  72. only to the root user. As clicking on this button causes NT to
  73. attempt to change the ownership of a file to the current user logged
  74. into the NT client this will not work with Samba at this time.
  75.  
  76. There is an NT chown command that will work with Samba and allow
  77. a user with Administrator privillage connected to a Samba 2.0.4
  78. server as root to change the ownership of files on both a local NTFS
  79. filesystem or remote mounted NTFS or Samba drive. This is available
  80. as part of the Seclib NT security library written by Jeremy
  81. Allison of the Samba Team, available from the main Samba ftp site.
  82.  
  83. Viewing file or directory permissions
  84.  
  85. -------------------------------------
  86.  
  87. The third button is the "Permissions" button. Clicking on this
  88. brings up a dialog box that shows both the permissions and the UNIX
  89. owner of the file or directory. The owner is displayed in the form :
  90.  
  91. "SERVER\user (Long name)"
  92.  
  93. Where SERVER is the NetBIOS name of the Samba server, user
  94. is the user name of the UNIX user who owns the file, and (Long name)
  95. is the discriptive string identifying the user (normally found in the
  96. GECOS field of the UNIX password database).
  97.  
  98. If the parameter "nt acl support"
  99. is set to "false" then the file owner will be shown as the NT user
  100. "Everyone" and the permissions will be shown as NT "Full Control".
  101.  
  102. The permissions field is displayed differently for files and directories,
  103. so I'll describe the way file permissions are displayed first.
  104.  
  105. File Permissions
  106.  
  107. ----------------
  108.  
  109. The standard UNIX user/group/world triple and the correspinding
  110. "read", "write", "execute" permissions triples are mapped by Samba
  111. into a three element NT ACL with the 'r', 'w', and 'x' bits mapped
  112. into the corresponding NT permissions. The UNIX world permissions are mapped
  113. into the global NT group Everyone, followed by the list of permissions
  114. allowed for UNIX world. The UNIX owner and group permissions
  115. are displayed as an NT user icon and an NT local group icon
  116. respectively followed by the list of permissions allowed for the
  117. UNIX user and group.
  118.  
  119. As many UNIX permission sets don't map into common NT names such as
  120. "read", "change" or "full control" then usually the permissions
  121. will be prefixed by the words "Special Access" in the NT display 
  122. list.
  123.  
  124. But what happens if the file has no permissions allowed for a
  125. particular UNIX user group or world component ? In order to 
  126. allow "no permissions" to be seen and modified then Samba overloads
  127. the NT "Take Ownership" ACL attribute (which has no meaning in
  128. UNIX) and reports a component with no permissions as having the NT
  129. "O" bit set. This was chosen of course to make it look like a
  130. zero, meaning zero permissions. More details on the decision behind
  131. this will be given below.
  132.  
  133. Directory Permissions
  134.  
  135. ---------------------
  136.  
  137. Directories on an NT NTFS file system have two different sets of
  138. permissions. The first set of permissions is the ACL set on the
  139. directory itself, this is usually displayed in the first set of
  140. parentheses in the normal "RW" NT style. This first set of
  141. permissions is created by Samba in exactly the same way as normal
  142. file permissions are, described above, and is displayed in the
  143. same way.
  144.  
  145. The second set of directory permissions has no real meaning in the
  146. UNIX permissions world and represents the "inherited" permissions
  147. that any file created within this directory would inherit.
  148.  
  149. Samba synthesises these inherited permissions for NT by returning as
  150. an NT ACL the UNIX permission mode that a new file created by Samba
  151. on this share would receive.
  152.  
  153. Modifying file or directory permissions
  154.  
  155. ---------------------------------------
  156.  
  157. Modifying file and directory permissions is as simple as changing
  158. the displayed permissions in the dialog box, and clicking the OK
  159. button. However, there are limitations that a user needs to be aware
  160. of, and also interactions with the standard Samba permission masks
  161. and mapping of DOS attributes that need to also be taken into account.
  162.  
  163. If the parameter "nt acl support"
  164. is set to "false" then any attempt to set security permissions will
  165. fail with an "Access Denied" message.
  166.  
  167. The first thing to note is that the "Add" button will not return
  168. a list of users in Samba 2.0.4 (it will give an error message of
  169. "The remote proceedure call failed and did not execute"). This
  170. means that you can only manipulate the current user/group/world
  171. permissions listed in the dialog box. This actually works quite well
  172. as these are the only permissions that UNIX actually has.
  173.  
  174. If a permission triple (either user, group, or world) is removed from
  175. the list of permissions in the NT dialog box, then when the "OK"
  176. button is pressed it will be applied as "no permissions" on the UNIX
  177. side. If you then view the permissions again the "no permissions" entry
  178. will appear as the NT "O" flag, as described above. This allows you
  179. to add permissions back to a file or directory once you have removed
  180. them from a triple component.
  181.  
  182. As UNIX supports only the "r", "w" and "x" bits of an NT ACL
  183. then if other NT security attributes such as "Delete access"
  184. are selected then they will be ignored when applied on the 
  185. Samba server.
  186.  
  187. When setting permissions on a directory the second set of permissions
  188. (in the second set of parentheses) is by default applied to all
  189. files within that directory. If this is not what you want you
  190. must uncheck the "Replace permissions on existing files" checkbox
  191. in the NT dialog before clicking "OK".
  192.  
  193. If you wish to remove all permissions from a user/group/world 
  194. component then you may either highlight the component and click
  195. the "Remove" button, or set the component to only have the special
  196. "Take Ownership" permission (dsplayed as "O") highlighted.
  197.  
  198. Interaction with the standard Samba create mask parameters
  199.  
  200. ----------------------------------------------------------
  201.  
  202. Note that with Samba 2.0.5 there are four new parameters to
  203. control this interaction.
  204.  
  205. These are :
  206.  
  207. security mask
  208. force security mode
  209. directory security mask
  210. force directory security mode
  211.  
  212. Once a user clicks "OK" to apply the permissions Samba maps
  213. the given permissions into a user/group/world r/w/x triple set,
  214. and then will check the changed permissions for a file against
  215. the bits set in the "security mask"
  216. parameter. Any bits that were changed that are not set to '1'
  217. in this parameter are left alone in the file permissions.
  218.  
  219. Essentially, zero bits in the "security mask"
  220. mask may be treated as a set of bits the user is not allowed to change,
  221. and one bits are those the user is allowed to change.
  222.  
  223. If not set explicitly this parameter is set to the same value as the
  224. "create mask" parameter to provide compatibility
  225. with Samba 2.0.4 where this permission change facility was introduced.
  226. To allow a user to modify all the user/group/world permissions on a file,
  227. set this parameter to 0777.
  228.  
  229. Next Samba checks the changed permissions for a file against the
  230. bits set in the "force security mode"
  231. parameter. Any bits that were changed that correspond to bits set
  232. to '1' in this parameter are forced to be set.
  233.  
  234. Essentially, bits set in the "force security mode"
  235. parameter may be treated as a set of bits that, when modifying security on a file, the
  236. user has always set to be 'on'.
  237.  
  238. If not set explicitly this parameter is set to the same value as the
  239. "force create mode" parameter to provide compatibility
  240. with Samba 2.0.4 where the permission change facility was introduced.
  241. To allow a user to modify all the user/group/world permissions on a file,
  242. with no restrictions set this parameter to 000.
  243.  
  244. The "security mask" and
  245. "force security mode" parameters
  246. are applied to the change request in that order.
  247.  
  248. For a directory Samba will perform the same operations as described above
  249. for a file except using the parameter "directory security mask"
  250. instead of "security mask", and 
  251. "force directory security mode" parameter instead
  252. of "force security mode".
  253.  
  254. The "directory security mask"
  255. parameter by default is set to the same value as the "directory mask"
  256. parameter and the "force directory security mode"
  257. parameter by default is set to the same value as the 
  258. iurl("force directory mode")(smb.conf.5.html#forcedirectorymode) parameter
  259. to provide compatibility with Samba 2.0.4 where the permission change facility was introduced.
  260.  
  261. In this way Samba enforces the permission restrictions that an administrator
  262. can set on a Samba share, whilst still allowing users to modify the
  263. permission bits within that restriction.
  264.  
  265. If you want to set up a share that allows users full control
  266. in modifying the permission bits on their files and directories and
  267. doesn't force any particular bits to be set 'on', then set the following
  268. parameters in the smb.conf.5 file in
  269. that share specific section :
  270.  
  271. security mask = 0777
  272. force security mode = 0
  273. directory security mask = 0777
  274. force directory security mode = 0
  275.  
  276. As described, in Samba 2.0.4 the parameters :
  277.  
  278. create mask
  279. force create mode
  280. directory mask
  281. force directory mode
  282.  
  283. were used instead of the parameters discussed here.
  284.  
  285. Interaction with the standard Samba file attribute mapping
  286.  
  287. ----------------------------------------------------------
  288.  
  289. Samba maps some of the DOS attribute bits (such as "read only")
  290. into the UNIX permissions of a file. This means there can be a
  291. conflict between the permission bits set via the security dialog
  292. and the permission bits set by the file attribute mapping.
  293.  
  294. One way this can show up is if a file has no UNIX read access
  295. for the owner it will show up as "read only" in the standard 
  296. file attributes tabbed dialog. Unfortunately this dialog is
  297. the same one that contains the security info in another tab.
  298.  
  299. What this can mean is that if the owner changes the permissions
  300. to allow themselves read access using the security dialog, clicks
  301. "OK" to get back to the standard attributes tab dialog, and
  302. then clicks "OK" on that dialog, then NT will set the file
  303. permissions back to read-only (as that is what the attributes
  304. still say in the dialog). This means that after setting permissions
  305. and clicking "OK" to get back to the attributes dialog you
  306. should always hit "Cancel" rather than "OK" to ensure
  307. that your changes are not overridden.
  308.